package com.tianhao.luo.use;

import com.tianhao.luo.NovelBook;

/**
 * @ClassName: OffNovelBook
 * @Description: 打折的书
 * @author: tianhao.luo@hand-china.com
 * @date: 2020/7/14  17:59
 */
public class OffNovelBook extends NovelBook {

    public OffNovelBook(String name, int price, String author) {
        super(name, price, author);
    }

    /**
     * 覆写销售价格
     * @return 打折价
     */
    @Override
    public int getPrice() {
        int price = super.getPrice();
        int offPrice =0;
        if (price > 4000) {
            offPrice = price*90/100;
        }else {
            offPrice = price*80/100;
        }
        return offPrice;
    }
}
